
package view;


import controller.ClienteControl;
import java.util.Calendar;
import model.ClienteModel;

public class Clientes extends javax.swing.JInternalFrame {

   ClienteControl ClienteControle= new ClienteControl();
    public Clientes() {
        initComponents();
        limpar();
        bloquear();
    }
   
    //comando para limpar
void limpar(){
    txtNomeCliente.setText("");
    txtFoneCliente.setText("");
    txtFone2Cliente.setText("");
    txtEnderecoCliente.setText("");
    txtNumeroCliente.setText("");
    txtComplementoCliente.setText("");
    txtBairroCliente.setText("");
    txtCidadeCliente.setText("");
    txtCepCliente.setText("");
    txtDataNascCliente.setText("");
    txtEmailCliente.setText("");
    txtaObservacaoCliente.setText("");
    }

// Comando para bloquear a tela
void bloquear(){
    txtNomeCliente.setEnabled(false);
    txtFoneCliente.setEnabled(false);
    txtFone2Cliente.setEnabled(false);
    txtEnderecoCliente.setEnabled(false);
    txtNumeroCliente.setEnabled(false);
    txtComplementoCliente.setEnabled(false);
    txtBairroCliente.setEnabled(false);
    txtCidadeCliente.setEnabled(false);
    txtCepCliente.setEnabled(false);
    txtDataNascCliente.setEnabled(false);
    txtEmailCliente.setEnabled(false);
    txtaObservacaoCliente.setEnabled(false);
    cmbxTipo.setEnabled(false);
    cmbxUfCliente.setEnabled(false);
    btnEditarCliente.setEnabled(false);
    btnCancelarCliente.setEnabled(false);
    btnSalvarCliente.setEnabled(false);
    btnNovoCliente.setEnabled(true);
    
}

// Desbloquear a tela, para inserir os dados
void desbloquear(){
    txtNomeCliente.setEnabled(true);
    txtFoneCliente.setEnabled(true);
    txtFone2Cliente.setEnabled(true);
    txtEnderecoCliente.setEnabled(true);
    txtNumeroCliente.setEnabled(true);
    txtComplementoCliente.setEnabled(true);
    txtBairroCliente.setEnabled(true);
    txtCidadeCliente.setEnabled(true);
    txtCepCliente.setEnabled(true);
    txtDataNascCliente.setEnabled(true);
    txtEmailCliente.setEnabled(true);
    txtaObservacaoCliente.setEnabled(true);
    cmbxTipo.setEnabled(true);
    cmbxUfCliente.setEnabled(true);
    btnEditarCliente.setEnabled(true);
    btnCancelarCliente.setEnabled(true);
    btnSalvarCliente.setEnabled(true);
    btnNovoCliente.setEnabled(false);
    
}
   
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        lblCodigoCliente = new javax.swing.JLabel();
        txtCodigoCliente = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        lblPesquisaTelefoneCliente = new javax.swing.JLabel();
        txtPesquisaTelefoneCliente = new javax.swing.JTextField();
        btnPesquisarCliente = new javax.swing.JButton();
        txtNomeCliente = new javax.swing.JTextField();
        txtEnderecoCliente = new javax.swing.JTextField();
        txtFone2Cliente = new javax.swing.JTextField();
        txtComplementoCliente = new javax.swing.JTextField();
        txtNumeroCliente = new javax.swing.JTextField();
        txtBairroCliente = new javax.swing.JTextField();
        lblFone1Cliente = new javax.swing.JLabel();
        btnNovoCliente = new javax.swing.JButton();
        btnEditarCliente = new javax.swing.JButton();
        btnCancelarCliente = new javax.swing.JButton();
        btnSalvarCliente = new javax.swing.JButton();
        btnSairCliente = new javax.swing.JButton();
        txtCepCliente = new javax.swing.JTextField();
        txtEmailCliente = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtaObservacaoCliente = new javax.swing.JTextArea();
        txtFoneCliente = new javax.swing.JTextField();
        lblNomeCliente = new javax.swing.JLabel();
        lblFone2Cliente = new javax.swing.JLabel();
        cmbxTipo = new javax.swing.JComboBox();
        txtCidadeCliente = new javax.swing.JTextField();
        cmbxUfCliente = new javax.swing.JComboBox();
        lblTipoEndCliente = new javax.swing.JLabel();
        lblEnderecoCliente = new javax.swing.JLabel();
        lblNumeroCliente = new javax.swing.JLabel();
        lblComplementoCliente = new javax.swing.JLabel();
        lblBairroCliente = new javax.swing.JLabel();
        lblCidadeCliente = new javax.swing.JLabel();
        lblEstadoCliente = new javax.swing.JLabel();
        lblCepCliente = new javax.swing.JLabel();
        lblEmailCliente = new javax.swing.JLabel();
        lblDataNascCliente = new javax.swing.JLabel();
        lblObservacaoCliente = new javax.swing.JLabel();
        lblMensagemCliente = new javax.swing.JLabel();
        txtDataNascCliente = new javax.swing.JFormattedTextField();

        setBackground(new java.awt.Color(255, 231, 63));
        setTitle("Clientes");
        setFocusable(false);
        setMaximumSize(new java.awt.Dimension(995, 571));
        setMinimumSize(new java.awt.Dimension(995, 571));
        setPreferredSize(new java.awt.Dimension(995, 571));

        jPanel1.setBackground(new java.awt.Color(255, 102, 0));

        lblCodigoCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblCodigoCliente.setForeground(new java.awt.Color(255, 255, 255));
        lblCodigoCliente.setText("Código");

        txtCodigoCliente.setBackground(new java.awt.Color(255, 255, 204));
        txtCodigoCliente.setEditable(false);
        txtCodigoCliente.setFont(new java.awt.Font("Monospaced", 1, 24)); // NOI18N
        txtCodigoCliente.setForeground(new java.awt.Color(255, 0, 0));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtCodigoCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblCodigoCliente)
                        .addGap(0, 95, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(lblCodigoCliente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtCodigoCliente)
                .addContainerGap())
        );

        jPanel2.setBackground(new java.awt.Color(255, 102, 0));

        lblPesquisaTelefoneCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblPesquisaTelefoneCliente.setForeground(new java.awt.Color(255, 255, 255));
        lblPesquisaTelefoneCliente.setText("Telefone");

        txtPesquisaTelefoneCliente.setBackground(new java.awt.Color(255, 255, 204));
        txtPesquisaTelefoneCliente.setFont(new java.awt.Font("Monospaced", 1, 24)); // NOI18N
        txtPesquisaTelefoneCliente.setForeground(new java.awt.Color(0, 0, 153));
        txtPesquisaTelefoneCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtPesquisaTelefoneClienteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblPesquisaTelefoneCliente)
                    .addComponent(txtPesquisaTelefoneCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(lblPesquisaTelefoneCliente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtPesquisaTelefoneCliente)
                .addContainerGap())
        );

        btnPesquisarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Pesquisar.png"))); // NOI18N
        btnPesquisarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPesquisarClienteActionPerformed(evt);
            }
        });

        txtNomeCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        txtEnderecoCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N
        txtEnderecoCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtEnderecoClienteActionPerformed(evt);
            }
        });

        txtFone2Cliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        txtComplementoCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        txtNumeroCliente.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N

        txtBairroCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        lblFone1Cliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblFone1Cliente.setText("Fone 1");

        btnNovoCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Botoes_5122_paper_48.png"))); // NOI18N
        btnNovoCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNovoClienteActionPerformed(evt);
            }
        });

        btnEditarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Botoes_5122_pencil_48.png"))); // NOI18N

        btnCancelarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Botoes_5123_cancel_48.png"))); // NOI18N
        btnCancelarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarClienteActionPerformed(evt);
            }
        });

        btnSalvarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Botoesaceitar.png"))); // NOI18N
        btnSalvarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalvarClienteActionPerformed(evt);
            }
        });

        btnSairCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/power icon 64x64.png"))); // NOI18N
        btnSairCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSairClienteActionPerformed(evt);
            }
        });

        txtCepCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N
        txtCepCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCepClienteActionPerformed(evt);
            }
        });

        txtEmailCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        txtaObservacaoCliente.setColumns(20);
        txtaObservacaoCliente.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N
        txtaObservacaoCliente.setRows(5);
        jScrollPane1.setViewportView(txtaObservacaoCliente);

        txtFoneCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        lblNomeCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblNomeCliente.setText("Nome");

        lblFone2Cliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblFone2Cliente.setText("Fone 2");

        cmbxTipo.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N
        cmbxTipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        txtCidadeCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        cmbxUfCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N
        cmbxUfCliente.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbxUfCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbxUfClienteActionPerformed(evt);
            }
        });

        lblTipoEndCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblTipoEndCliente.setText("Tipo");

        lblEnderecoCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblEnderecoCliente.setText("Endereço");

        lblNumeroCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblNumeroCliente.setText("Número");

        lblComplementoCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblComplementoCliente.setText("Complemento");

        lblBairroCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblBairroCliente.setText("Bairro");

        lblCidadeCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblCidadeCliente.setText("Cidade");

        lblEstadoCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblEstadoCliente.setText("Estado");

        lblCepCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblCepCliente.setText("CEP");

        lblEmailCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblEmailCliente.setText("Email");

        lblDataNascCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblDataNascCliente.setText("Data Nasc.");

        lblObservacaoCliente.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblObservacaoCliente.setText("Observações");

        lblMensagemCliente.setText("Mensagem");

        try {
            txtDataNascCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtDataNascCliente.setFont(new java.awt.Font("Monospaced", 1, 16)); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(85, 85, 85)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnPesquisarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(80, 80, 80)
                        .addComponent(lblMensagemCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(lblObservacaoCliente)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnNovoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnEditarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnCancelarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(300, 300, 300)
                        .addComponent(btnSalvarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnSairCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(lblTipoEndCliente)
                                    .addGap(163, 163, 163)
                                    .addComponent(lblEnderecoCliente))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(cmbxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(txtEnderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 493, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(33, 33, 33)
                                    .addComponent(lblNumeroCliente))
                                .addComponent(txtNumeroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 829, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(lblComplementoCliente)
                                    .addGap(154, 154, 154)
                                    .addComponent(lblBairroCliente)
                                    .addGap(240, 240, 240)
                                    .addComponent(lblCidadeCliente))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(txtComplementoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(txtBairroCliente)
                                    .addGap(18, 18, 18)
                                    .addComponent(txtCidadeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(cmbxUfCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(lblEstadoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(lblCepCliente)
                                    .addGap(0, 0, Short.MAX_VALUE))
                                .addComponent(txtCepCliente))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblDataNascCliente)
                                .addComponent(txtDataNascCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblEmailCliente)
                                .addComponent(txtEmailCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 436, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(txtNomeCliente)
                                    .addGap(18, 18, 18))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addComponent(lblNomeCliente)
                                    .addGap(445, 445, 445)))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(lblFone1Cliente)
                                    .addGap(143, 143, 143)
                                    .addComponent(lblFone2Cliente))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(txtFoneCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(txtFone2Cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                .addContainerGap(65, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnPesquisarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(24, 24, 24)
                                .addComponent(lblMensagemCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNomeCliente)
                            .addComponent(lblFone1Cliente)
                            .addComponent(lblFone2Cliente))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtFoneCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtFone2Cliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblTipoEndCliente)
                            .addComponent(lblEnderecoCliente)
                            .addComponent(lblNumeroCliente))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cmbxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtEnderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtNumeroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblComplementoCliente)
                                    .addComponent(lblBairroCliente)
                                    .addComponent(lblCidadeCliente))
                                .addGap(9, 9, 9)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtComplementoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtBairroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblEstadoCliente)
                                .addGap(9, 9, 9)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(cmbxUfCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtCidadeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lblEmailCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtEmailCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblCepCliente)
                                    .addComponent(lblDataNascCliente))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtCepCliente)
                                    .addComponent(txtDataNascCliente))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblObservacaoCliente)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnNovoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnEditarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCancelarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnSalvarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnSairCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtPesquisaTelefoneClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPesquisaTelefoneClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtPesquisaTelefoneClienteActionPerformed

    private void txtEnderecoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEnderecoClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtEnderecoClienteActionPerformed

    private void txtCepClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCepClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCepClienteActionPerformed

    private void btnSairClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairClienteActionPerformed
     this.dispose();
    }//GEN-LAST:event_btnSairClienteActionPerformed

    private void btnNovoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNovoClienteActionPerformed
    desbloquear();
    limpar();
    }//GEN-LAST:event_btnNovoClienteActionPerformed

    private void btnCancelarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarClienteActionPerformed
    bloquear();
    }//GEN-LAST:event_btnCancelarClienteActionPerformed

    private void btnSalvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarClienteActionPerformed
        if(txtNomeCliente.getText().trim().equals("")){
        }
        if(txtFoneCliente.getText().trim().equals("")){
        }
        if(txtFone2Cliente.getText().trim().equals("")){
        }
        if(txtEnderecoCliente.getText().trim().equals("")){
        }
        if(txtNumeroCliente.getText().trim().equals("")){
        }
        if(txtBairroCliente.getText().trim().equals("")){
        }
        if(txtComplementoCliente.getText().trim().equals("")){
        }
        if(txtBairroCliente.getText().trim().equals("")){
        }
        if(txtCidadeCliente.getText().trim().equals("")){
        }
        // Validar UF
        if(txtCepCliente.getText().trim().equals("")){
        }
        // Validar data de nascimento
        if(txtEmailCliente.getText().trim().equals("")){
            // Campos vazios
            lblMensagemCliente.setText("Preencha todos os campos");
        }
        else {
            lblMensagemCliente.setText("Sucesso");
        }
        
        
        
        ClienteModel Cliente= new ClienteModel();
        Cliente.Nome=txtNomeCliente.getText();
        Cliente.Endereco=txtEnderecoCliente.getText();
        Cliente.DataNasc=Calendar.getInstance();
        Cliente.DataNasc.set(2012, 10, 31); // Alterar por variaveis
        // Mensagem sobre cadastro no banco de dados
        if (ClienteControle.CadastrarCliente(Cliente)) {
            lblMensagemCliente.setText("Erro ao cadastrar");
            lblMensagemCliente.setVisible(true);
        }
        else
        {
            lblMensagemCliente.setText("Cadastrado com sucesso");
            lblMensagemCliente.setVisible(true);
        }
        
     
    }//GEN-LAST:event_btnSalvarClienteActionPerformed

    private void cmbxUfClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbxUfClienteActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cmbxUfClienteActionPerformed

    private void btnPesquisarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPesquisarClienteActionPerformed
     PesquisarCliente pc = new PesquisarCliente();
     this.add(pc);
     pc.show();
    }//GEN-LAST:event_btnPesquisarClienteActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelarCliente;
    private javax.swing.JButton btnEditarCliente;
    private javax.swing.JButton btnNovoCliente;
    private javax.swing.JButton btnPesquisarCliente;
    private javax.swing.JButton btnSairCliente;
    private javax.swing.JButton btnSalvarCliente;
    private javax.swing.JComboBox cmbxTipo;
    private javax.swing.JComboBox cmbxUfCliente;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblBairroCliente;
    private javax.swing.JLabel lblCepCliente;
    private javax.swing.JLabel lblCidadeCliente;
    private javax.swing.JLabel lblCodigoCliente;
    private javax.swing.JLabel lblComplementoCliente;
    private javax.swing.JLabel lblDataNascCliente;
    private javax.swing.JLabel lblEmailCliente;
    private javax.swing.JLabel lblEnderecoCliente;
    private javax.swing.JLabel lblEstadoCliente;
    private javax.swing.JLabel lblFone1Cliente;
    private javax.swing.JLabel lblFone2Cliente;
    private javax.swing.JLabel lblMensagemCliente;
    private javax.swing.JLabel lblNomeCliente;
    private javax.swing.JLabel lblNumeroCliente;
    private javax.swing.JLabel lblObservacaoCliente;
    private javax.swing.JLabel lblPesquisaTelefoneCliente;
    private javax.swing.JLabel lblTipoEndCliente;
    private javax.swing.JTextField txtBairroCliente;
    private javax.swing.JTextField txtCepCliente;
    private javax.swing.JTextField txtCidadeCliente;
    private javax.swing.JTextField txtCodigoCliente;
    private javax.swing.JTextField txtComplementoCliente;
    private javax.swing.JFormattedTextField txtDataNascCliente;
    private javax.swing.JTextField txtEmailCliente;
    private javax.swing.JTextField txtEnderecoCliente;
    private javax.swing.JTextField txtFone2Cliente;
    private javax.swing.JTextField txtFoneCliente;
    private javax.swing.JTextField txtNomeCliente;
    private javax.swing.JTextField txtNumeroCliente;
    private javax.swing.JTextField txtPesquisaTelefoneCliente;
    private javax.swing.JTextArea txtaObservacaoCliente;
    // End of variables declaration//GEN-END:variables
}
